package Integrity;


public class DataInt_ErrorChecking_Interface {
	
	DataInt_ErrorChecking_Interface(String usID, String bsID, String fl) throws Exception {
		
		UserID = usID;
                BillingSiteID = bsID;
		XmlFileName = fl;
		
		extract = new Xml_Extracted_Data(XmlFileName);
		Scaper_APS_Errors_Checks saec = new Scaper_APS_Errors_Checks(extract);
		
		if (saec.XMLhas_ErrorCode() == false){
			
			Data_Int_Checks dic = new Data_Int_Checks(extract);
			resultErrorCode = dic.getErrorCode();
			if (resultErrorCode.equals("NONE")){
				resultErrorType = "NONE";				
			}
			resultErrorType = "DIC";
		}
		else {
			resultErrorCode = extract.get_scraped_error_code();
			resultErrorType = "ERR";
		}
		
		ResultID = getResultID();
		
		factory = new ResultFactory (UserID,ResultID,BillingSiteID,resultErrorType,extract);
		result = factory.createResult();
		//DBMan.storeResult(result)
	}
	
	public int getResultID(){
		ResultID ++;
		return ResultID;	 
	}
	 private String XmlFileName;
	 private int ResultID = 1000000;
	 private String UserID;
     private String BillingSiteID;
	 private String resultErrorType;
	 private String resultErrorCode = "NONE";
	 Xml_Extracted_Data extract;
	 
	 ResultFactory factory;
	 Result result;
}
